﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;

namespace TFSBugTracking.Web
{
    /// <summary>
    /// the master site 
    /// </summary>
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        /// <summary>
        /// when loading the site, show the impersonated user in the title
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {

            try
            {
                var sc = ((MasterPage) this).GetSessionCore();
                _currentUser.Text = string.Format("{0}   ->   {1}    [ Version: {2}]", 
                    sc.CurrentUser, sc.ImpersonatedUser,Assembly.GetExecutingAssembly().GetName().Version);
            }
            catch (Exception exception)
            {
                _currentUser.Text = exception.Message; 
            }

        }
    }
}
